package com.wing.common.enums;

import lombok.Data;

import static com.wing.common.enums.MaintenanceEnum.StatusEnum.getNameByCode;

/**
 * @version 1.1.0
 * @Author hz
 * @Date 2024-08-21 14:15
 **/
public interface MaintenanceEnum {

    enum TaskEmum{
        RLRW("1","认领任务"),
        LSRW("2","临时任务"),
        XTRW("3","系统任务");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        TaskEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            TaskEmum[] homeServiceStatuses = values();
            for (TaskEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            TaskEmum[] homeServiceStatuses = values();
            for (TaskEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum StatusEnum{
        DRL("1","待认领"),
        YRL("2","已认领"),
        YCJ("3","已创建"),
        WC("4","完成");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        StatusEnum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            StatusEnum[] homeServiceStatuses = values();
            for (StatusEnum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            StatusEnum[] homeServiceStatuses = values();
            for (StatusEnum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum AduitEnum{
        DSH("0","待审核"),
        SHTG("1","审核通过"),
        WTG("2","未通过");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        AduitEnum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            AduitEnum[] homeServiceStatuses = values();
            for (AduitEnum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            AduitEnum[] homeServiceStatuses = values();
            for (AduitEnum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    /**
     * 任务来源
     */
    enum Task_Source_Enum{
        KHDD("1","客户订单"),
        ZYCP("2","自研产品");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        Task_Source_Enum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            Task_Source_Enum[] homeServiceStatuses = values();
            for (Task_Source_Enum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            Task_Source_Enum[] homeServiceStatuses = values();
            for (Task_Source_Enum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    /**
     * 任务状态
     */
    enum Task_Status_Enum{
        CG("1","草稿"),
        DQR("2","待确认"),
        DGH("3","待规划"),
        DJD("4","待校对"),
        DDX("5","待定型"),
        YDX("6","已定型");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        Task_Status_Enum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            Task_Status_Enum[] homeServiceStatuses = values();
            for (Task_Status_Enum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            Task_Status_Enum[] homeServiceStatuses = values();
            for (Task_Status_Enum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    enum DrawTypeEnum{
        CPTZ("1","成品图纸"),
        GXTZ("2","工序图纸"),
        MJTZ("3","模具图纸"),
        JZJTZ("4","夹治具图纸"),
        QTTZ("5","其他图纸");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        DrawTypeEnum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            DrawTypeEnum[] homeServiceStatuses = values();
            for (DrawTypeEnum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            DrawTypeEnum[] homeServiceStatuses = values();
            for (DrawTypeEnum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    enum TASK_PROOFREAD_ENUM{
        GDTG("1","校对通过"),
        BHTZ("2","驳回调整");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        TASK_PROOFREAD_ENUM(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            TASK_PROOFREAD_ENUM[] homeServiceStatuses = values();
            for (TASK_PROOFREAD_ENUM homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            TASK_PROOFREAD_ENUM[] homeServiceStatuses = values();
            for (TASK_PROOFREAD_ENUM homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    //状态(1. 已初审 2.待排产 3.打样中 4.待校对 5.待终审 6.已定型)
    enum BenchmarkBookStatus{
        DCS("1","待初审"),
        DPC("2","待排产"),
        DYZ("3","打样中"),
        DJD("4","已校对"),
        DZS("5","已终审"),
        YDX("6","已定型"),
        YZF("7","已作废");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        BenchmarkBookStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            BenchmarkBookStatus[] homeServiceStatuses = values();
            for (BenchmarkBookStatus homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            BenchmarkBookStatus[] homeServiceStatuses = values();
            for (BenchmarkBookStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum BenchmarkBookType{
        DYJZS("1","打样基准书"),
        ZSJZS("2","正式基准书");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        BenchmarkBookType(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            BenchmarkBookType[] homeServiceStatuses = values();
            for (BenchmarkBookType homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            BenchmarkBookType[] homeServiceStatuses = values();
            for (BenchmarkBookType homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }
    enum QualityStatus {
        SJZ(0, "送检中"),
        WC(1, "完成"),
        DRL(2, "待认领"),
        GB(3, "关闭"),
        ZF(4, "作废");

        private int code;

        private String name;

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        QualityStatus(int code, String name) {
            this.code = code;
            this.name = name;
        }

        ;

        /**
         * 根据服务code获取服务名称
         *
         * @param code
         * @return
         */
        public static String getNameByCode(int code) {
            QualityStatus[] homeServiceStatuses = values();
            for (QualityStatus homeService : homeServiceStatuses) {
                if (homeService.getCode() == code) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         *
         * @param name
         * @return
         */
        public static int getCodeByName(String name) {
            QualityStatus[] homeServiceStatuses = values();
            for (QualityStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return -1;
        }

    }
    /**
     * 工位性质名称 枚举
     */
    enum workstationEmum{
        SBGW("1","设备工位"),
        RGGW("2","人工工位"),
        QT("3","其他");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        workstationEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            workstationEmum[] values = values();
            for (workstationEmum homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            workstationEmum[] values = values();
            for (workstationEmum homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    /**
     * 检测类型 枚举
     */
    enum qualityNatureEmum{
        YWYJ("1","一物一检"),
        PTJC("2","普通检测"),
        BXY("0","不需要检测");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        qualityNatureEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            qualityNatureEmum[] values = values();
            for (qualityNatureEmum homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            qualityNatureEmum[] values = values();
            for (qualityNatureEmum homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 工序类型 枚举
     */
    enum gxTypeEmum{
        SGX("0","首工序"),
        GCGX("1","过程工序"),
        MGX("2","末工序");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        gxTypeEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            gxTypeEmum[] values = values();
            for (gxTypeEmum homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            gxTypeEmum[] values = values();
            for (gxTypeEmum homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 排产类型 枚举
     */
    enum pcStatusEmum{
        DPC("1","待计划"),
        PCZ("2","计划中"),
        PCWC("3","计划完成");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        pcStatusEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            pcStatusEmum[] values = values();
            for (pcStatusEmum homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            pcStatusEmum[] values = values();
            for (pcStatusEmum homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * errorStatus
     */
    enum errorStatus{
        ZC("1","正常"),
        TY("2","停用");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        errorStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            errorStatus[] values = values();
            for (errorStatus homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            errorStatus[] values = values();
            for (errorStatus homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * planRecordStatus 制造令
     */
    enum planRecordStatus{

        PCZ("1","排产中"),
        PCWC("2","排产完成"),
        SDJS("3","手动结束"),
        ZDJS("4","自动结束");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        planRecordStatus(String code, String name){
            this.code = code;
            this.name = name;
        }

        /**
         * 根据服务code获取服务名称
         * @param code code
         * @return
         */
        public static String getNameByCode(String code) {
            planRecordStatus[] values = values();
            for (planRecordStatus homeService : values) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name name
         * @return
         */
        public static String getCodeByName(String name) {
            planRecordStatus[] values = values();
            for (planRecordStatus homeService : values) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }
}
